#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void Input(int x[], char y[][80]);
void Found(int x[],char y[][80], int z);

int main()
{
	int arr1[10] = { 0 };
	char arr2[10][80] = { '0' };
	Input(arr1, arr2);
	int a = 0;
	printf("Please input the student’s number which need to find:\n");
	scanf("%d", &a);
	Found(arr1,arr2,a);
	return 0;
}
void Input(int x[], char y[][80])//初始化
{
	int i = 0;
	printf("Please input student number:\n");
	for (i = 0; i < 10; i++)
	{
		scanf("%d", &x[i]);
	}
	printf("Please input student’name:\n");
	for (i = 0; i < 10; i++)
	{
		scanf("%s", &y[i][0]);
	}
}
void Found(int x[],char y[][80], int z)
{
	int i = 0;
	int j = 0;
	int lift = 0;//左下标
	int right = 10 - 1;//右下标
	int mid = 0;//中间下标
	while(lift<=right)//二分查找
	{
		mid = (lift+right)/2;
		if (z < x[mid])
		{
			right = mid - 1;
		}
		else if (z > x[mid])
		{
			lift = mid + 1;
		}
		else
		{
			break;
		}
	}
	printf("学号%d所对应的学生为：%s",x[mid], &y[mid]);

}